/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.llantas.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author VENUMLEO
 */
@Entity
@Table(name = "articulo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Articulo.findAll", query = "SELECT a FROM Articulo a"),
    @NamedQuery(name = "Articulo.findByIdarticulo", query = "SELECT a FROM Articulo a WHERE a.idarticulo = :idarticulo"),
    @NamedQuery(name = "Articulo.findByTipollanta", query = "SELECT a FROM Articulo a WHERE a.tipollanta = :tipollanta"),
    @NamedQuery(name = "Articulo.findByMarca", query = "SELECT a FROM Articulo a WHERE a.marca = :marca"),
    @NamedQuery(name = "Articulo.findByRodado", query = "SELECT a FROM Articulo a WHERE a.rodado = :rodado"),
    @NamedQuery(name = "Articulo.findByNumeracion", query = "SELECT a FROM Articulo a WHERE a.numeracion = :numeracion"),
    @NamedQuery(name = "Articulo.findByPrecio", query = "SELECT a FROM Articulo a WHERE a.precio = :precio"),
    @NamedQuery(name = "Articulo.findByGarantia", query = "SELECT a FROM Articulo a WHERE a.garantia = :garantia"),
    @NamedQuery(name = "Articulo.findByClave", query = "SELECT a FROM Articulo a WHERE a.clave = :clave"),
    @NamedQuery(name = "Articulo.findDuplicity", query ="SELECT a FROM Articulo a WHERE a.marca = :marca AND a.rodado = :rodado AND a.tipollanta = :tipollanta")})
public class Articulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idarticulo")
    private Integer idarticulo;
    @Size(max = 45)
    @Column(name = "tipollanta")
    private String tipollanta;
    @Size(max = 45)
    @Column(name = "marca")
    private String marca;
    @Column(name = "rodado")
    private Integer rodado;
    @Column(name = "numeracion")
    private Integer numeracion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "precio")
    private Float precio;
    @Column(name = "garantia")
    private Integer garantia;
    @Column(name = "clave")
    private Integer clave;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "articuloIdarticulo")
    private List<Detalleventa> detalleventaList;

    public Articulo() {
    }

    public Articulo(Integer idarticulo) {
        this.idarticulo = idarticulo;
    }

    public Integer getIdarticulo() {
        return idarticulo;
    }

    public void setIdarticulo(Integer idarticulo) {
        this.idarticulo = idarticulo;
    }

    public String getTipollanta() {
        return tipollanta;
    }

    public void setTipollanta(String tipollanta) {
        this.tipollanta = tipollanta;
    }

    public String getMarca() {
        return marca;
    }

    public void setMarca(String marca) {
        this.marca = marca;
    }

    public Integer getRodado() {
        return rodado;
    }

    public void setRodado(Integer rodado) {
        this.rodado = rodado;
    }

    public Integer getNumeracion() {
        return numeracion;
    }

    public void setNumeracion(Integer numeracion) {
        this.numeracion = numeracion;
    }

    public Float getPrecio() {
        return precio;
    }

    public void setPrecio(Float precio) {
        this.precio = precio;
    }

    public Integer getGarantia() {
        return garantia;
    }

    public void setGarantia(Integer garantia) {
        this.garantia = garantia;
    }

    public Integer getClave() {
        return clave;
    }

    public void setClave(Integer clave) {
        this.clave = clave;
    }

    @XmlTransient
    public List<Detalleventa> getDetalleventaList() {
        return detalleventaList;
    }

    public void setDetalleventaList(List<Detalleventa> detalleventaList) {
        this.detalleventaList = detalleventaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idarticulo != null ? idarticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articulo)) {
            return false;
        }
        Articulo other = (Articulo) object;
        if ((this.idarticulo == null && other.idarticulo != null) || (this.idarticulo != null && !this.idarticulo.equals(other.idarticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itschapala.dsw2.llantas.modelo.Articulo[ idarticulo=" + idarticulo + " ]";
    }
    
}
